#ctree-tree-styles () {
  // prefix
  @tree-prefix: ~"@{ctree-prefix}-tree";
  @tree-node-prefix: ~"@{tree-prefix}-node";
  @tree-expand-animation: ~'@{ctree-prefix}-expand-animation';

  // Tree
  .@{tree-prefix} {
    // 覆盖整个树并且垂直居中
    .wrap-tree () {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      position: absolute;
      top: 0;
      left: 0;
    }

    // 容器
    &__wrapper {
      width: 100%;
      height: 100%;
      position: relative;
    }

    // 滚动区域
    &__scroll-area {
      width: 100%;
      height: 100%;
      overflow: auto;
      position: relative;
      display: flex;
      /* 自定义滚动条整体样式 */
      // &::-webkit-scrollbar {
      //   /* 高宽分别对应横竖滚动条的尺寸 */
      //   width: 10px;
      //   height: 1px;
      // }
      // /* 滚动条里面小方块 */
      // &::-webkit-scrollbar-thumb {
      //   border-radius: 6px;
      //   background-color: rgba(144,147,153,.5);
      //   transition: background-color .3s;
      //   cursor: pointer;
      //   display: none;
      // }
      // /* 滚动条里面轨道 */
      // &::-webkit-scrollbar-track {
      //   background: transparent;
      // }
    }

    // 数据块区域
    &__block-area {
      flex: 1;
    }

    // 暂无数据
    &__empty {
      .wrap-tree();
      &-text_default {
        // 水平居中
        width: 100%;
        text-align: center;
        color: rgba(0,0,0,.25);
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        .text-content {
          margin-top: 8px;
        }
      }
    }

    // 加载中
    &__loading {
      .wrap-tree();
      background-color: rgba(255, 255, 255, 1);
      align-items: flex-start;
      &-wrapper {
        width: 100%;
        text-align: center;
      }
      &-icon {
        #ctree-loading-icon-styles();
      }
    }

    // iframe
    &__iframe {
      .wrap-tree();
      display: block;
      border: none;
      padding: 0px;
      margin: 0px;
      opacity: 0;
      z-index: -1000;
      pointer-events: none;
    }
  }

  // Node
  .@{tree-node-prefix} {
    @base-square-length: 20px;

    // 缩进
    &__indent-wrapper {
      display: flex;
      padding-bottom: 4px;
    }

    // 容器
    &__wrapper {
      display: flex;
      flex-direction: column;
      transition: all 0.2s;
      flex: 1;
      border-radius: 6px;
      &:hover {
        background-color: #f0f0f0;
      }
    }

    // 拖拽区域
    &__drop {
      width: 100%;
      height: 2px;

      &_active {
        background-color: @ctree-color-light-primary;
      }
    }

    // 节点本体
    &__node-body {
      flex: 1;
      display: flex;
      align-items: center;
      padding: 0 8px;
    }

    // 占位
    &__square {
      position: relative;
      width: @base-square-length;
      height: @base-square-length;
      display: flex;
      flex-shrink: 0;
      align-items: center;
      justify-content: center;
    }

    // 展开 icon
    &__expand {
      @icon-border-width: 5px;
      // 展开图标可点击区域大小
      @icon-clickable-size: 16px;

      &::after {
        content: '';
        display: block;
        // width: 0;
        // height: 0;
        // position: absolute;
        border: @icon-border-width solid transparent;
        border-left: @icon-border-width solid rgba(0, 0, 0, 0.88);
      }

      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      width: @icon-clickable-size;
      height: @icon-clickable-size;
      position: relative;
      transition: transform .2s linear;

      // 展开状态，顺时针旋转 90 度
      &_active{
        transform: rotate(90deg);
      }
    }

    // Loading icon
    &__loading-icon {
      #ctree-loading-icon-styles(14px, @ctree-color-content);
    }

    // 复选框
    &__checkbox {
      @checkbox-size: 16px;

      .active-color () {
        border-color: @ctree-color-primary;
        background-color: @ctree-color-primary;
      }

      box-sizing: border-box;
      cursor: pointer;
      width: @checkbox-size;
      height: @checkbox-size;
      position: absolute;
      border: 1px solid;
      border-color: @ctree-color-border;
      border-radius: 4px;
      background-color: #fff;
      transition: border-color .2s ease-in-out,
                  background-color .2s ease-in-out,
                  box-shadow .2s ease-in-out;
      
      &::after {
        content: "";
        display: table;
        position: absolute;
        box-sizing: border-box;
        border: 2px solid #fff;
        border-top: 0;
        border-left: 0;
        width: 4px;
        height: 8px;
        top: 1px;
        left: 4px;
        transform: rotate(45deg) scale(0);
        transition: all .2s ease-in-out;
      }

      &:hover {
        border-color: @ctree-color-disabled;
      }

      &:focus {
        box-shadow: 0 0 0 2px @ctree-color-light-primary;
      }

      &_checked {
        .active-color();

        &::after {
          width: 4px;
          height: 8px;
          top: 2px;
          left: 5px;
          transform: rotate(45deg) scale(1);
        }

        &:hover {
          .active-color();
        }
      }

      &_indeterminate {
        .active-color();

        &::after {
          width: 8px;
          height: 1px;
          top: 6px;
          left: 3px;
          transform: scale(1);
        }

        &:hover {
          .active-color();
        }
      }

      &_disabled {
        cursor: not-allowed;
        border-color: @ctree-color-border;
        background-color: @ctree-color-divider;

        &:hover {
          border-color: @ctree-color-border;
          background-color: @ctree-color-divider;
        }

        &::after {
          border-color: @ctree-color-disabled;
        }
      }
    }

    // 标题
    &__title {
      @title-height: @base-square-length + 6px;
      @title-margin-left: 0;
      @title-padding-left: 5px;

      cursor: pointer;
      user-select: none;
      // flex: 1;
      // height: @title-height;
      width: 100%;
      height: 100%; // FIX: IE垂直居中
      line-height: @title-height;
      margin-left: @title-margin-left;
      padding-left: @title-padding-left;
      background-color: transparent;
      word-break: keep-all;
      white-space: nowrap;
      word-wrap: none;
      color: rgba(0, 0, 0, 0.88);
      font-size: 14px;
      border-radius: 6px;
      transition: all 0.2s, border 0s, line-height 0s, box-shadow 0s;

      // &:hover {
      //   background-color: #f0f0f0;
      // }

      &_selected {
        .selected () {
          background-color: #f0f0f0;
        }

        .selected();

        &:hover {
          .selected();
        }
      }

      &_disabled {
        cursor: not-allowed;
        color: @ctree-color-disabled;
      }
    }

    // &__title_selected {
    //   .ctree-tree-node__title {
    //     background-color: #f0f0f0;
    //   }
    // }
  }

  .@{tree-expand-animation} {
    &-enter,
    &-leave-to {
      opacity: 0;
      grid-template-rows: 0fr;
    }

    &-enter-to,
    &-leave {
      opacity: 1;
      grid-template-rows: 1fr;
    }

    &-enter-active,
    &-leave-active {
      transition: opacity .3s, grid-template-rows .3s;
    }
  }
}

#ctree-tree-styles();
